﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;

namespace CrushCrumbleChomp
{
    /// <summary>
    ///     Helper class for the animation system.
    /// </summary>
    class Animation
    {
        /// <summary>
        ///     Name of the animation
        /// </summary>
        public string name;
        /// <summary>
        ///     Milliseconds between frames
        /// </summary>
        public float delay;
        /// <summary>
        ///     List of frames for the animation (probably should be rectangles or points, we'll see)
        /// </summary>
        public List<Rectangle> frames;
        /// <summary>
        ///     Whether the animation repeats or not
        /// </summary>
        public bool looped;
        /// <summary>
        ///     Frame rate if none is specified (60 FPS)
        /// </summary>
        public const uint DEFAULT_FRAME_RATE = 60;

        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="name">What the animation should be called, e.g. "idle"</param>
        /// <param name="frameRate">Speed in FPS of the animation</param>
        /// <param name="frames">List of rectangles that describe each frame's location and size</param>
        /// <param name="looped">Whether the animation is looped or plays once only</param>
        public Animation(string name, List<Rectangle> frames, uint frameRate = DEFAULT_FRAME_RATE, bool looped = true)
        {
            this.name = name;
            this.delay = 1000.0f / frameRate;
            this.frames = frames;
            this.looped = looped;
        }

    }
}
